home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Demos / Extend 3.0 Demo / Demo Libraries / Demo Engineering Lib / Demo Engineering Lib.rsrc / MODL_19710_Noise Generator < prev    next >
Encoding:
Text File  |  1994-06-22  |  1.6 KB  |  49 lines

  1. ** This message occurs for each step in the simulation.
  2. on simulate
  3. {
  4. conOut = amplitude*(randomreal()-0.5)+meanValue;
  5.  
  6. ** sysGlobal2 is the file reference number for the DEBUG TRACE
  7. if( sysGlobal2 != 0.0 )    ** 0 is error, check for open file for TRACE
  8.     {
  9. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  10.     fileWrite(sysGlobal2,"Noise Generator                  block number "+(MyBlockNumber())+".  Current Time:"+currentTime+".","",True);
  11.     if(getBlockLabel(myBlockNumber()) != "")
  12.         fileWrite(sysGlobal2,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  13.     fileWrite(sysGlobal2,"     Output = "+ConOut,"",True);
  14.     fileWrite(sysGlobal2," ","",True);
  15.     }
  16. }
  17.  
  18. on endSim
  19. {
  20. ** sysGlobal1 is the file reference number for the TEXT REPORT
  21. if( sysGlobal1 != 0.0 ) ** 0 is error, check for open file for REPORT
  22.     {
  23. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  24.     fileWrite(sysGlobal1,"Noise Generator                  block number "+(MyBlockNumber()),"",True);
  25.     if(getBlockLabel(myBlockNumber()) != "")
  26.         fileWrite(sysGlobal1,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  27.     fileWrite(sysGlobal1,"     Amplitude, pp max = "+amplitude,"",True);
  28.     fileWrite(sysGlobal1,"     Mean Value = "+meanValue,"",True);
  29.     if( comments != "" )
  30.         fileWrite(sysGlobal1,"     Comments = "+comments,"",True);        
  31.     fileWrite(sysGlobal1," ","",True);
  32.     }
  33. }
  34.  
  35. ** If the dialog data is inconsistent for simulation, abort.
  36. on checkdata
  37. {
  38. if (novalue(amplitude))
  39.     abort;
  40. }
  41.  
  42.  
  43. ** Initialize any simulation variables.
  44. on initsim
  45. {
  46.  
  47. }
  48.  
  49.